package com.light.wanting.emoji.controller;

import com.light.applet.common.result.Result;
import com.light.wanting.emoji.Category;
import com.light.wanting.emoji.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: 魏彪
 */
@RestController
@RequestMapping("/category")
@CrossOrigin
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * <p>Title : findAll</p>
     * <p>Description : 查询Category全部数据</p>
     *
     * @return
     */
    @GetMapping(value = "/all")
    public Result<List<Category>> findAll() {
        // 调用CategoryService实现查询所有Category
        List<Category> list = categoryService.list();
        return Result.ok(list);
    }

}
